﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WINBASE;
using WINBASE.Controls;
using WINBASE.Utils.DBHelper;


namespace WINBASE_TEST
{
    public partial class frmeTest : WINBASE.WLCMainForm
    {
        WLCFrmSelectList frmCityList;
        WLCFrmSelectList frmCountryList;
        QueryHelper queryHelper = ApplicationService.QueryHelper;

        public frmeTest()
        {
            InitializeComponent();

            //City Browse Form
            frmCityList = new WLCFrmSelectList();
            frmCityList.Name = "frmeCityList";
            frmCityList.Text = "City List";
            frmCityList.ViewName = "vw_rcct1";
            frmCityList.InitializeData();
            txtCityCode.ParentLabel = label6;
            
            txtCityCode.NameTextBox = txtCityName;
            //Advance Binding For Country of the City
            txtCityCode.AdvanceBinding.Add(new AdvanceBindingItem(txtCountryCode, "Country Code"));
            txtCityCode.AdvanceBinding.Add(new AdvanceBindingItem(txtCountryName, "Country Name"));

            //Country Browse Form
            frmCountryList = new WLCFrmSelectList();
            frmCountryList.Name = "frmeCountryList";
            frmCountryList.Text = "Country List";
            frmCountryList.ViewName = "vw_rccy1";
            txtCountryCode.NameTextBox = txtCountryName;
        }

        private void txtCityCode_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F4)
            {
                string strFilter = "";
                if (!string.IsNullOrWhiteSpace(txtCountryCode.Text))
                {
                    strFilter += (strFilter.Length <= 0 ? "" : " AND ") + "[Country Code] = '" + txtCountryCode.Text.Trim() + "'";    
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string PartyCode = "aa";
            string StatusCode = "USE";
            queryHelper.GetACommand("SELECT * FROM rcbp1 WHERE BusinessPartyCode = @PartyCode AND StatusCode = @StatusCode", PartyCode,StatusCode );
        }
    }
}
